//- Copyright (C) 2023 Beijing Huaxia Chunsong Technology Co., Ltd. 
//- <https://www.chatopera.com>, Licensed under the Chunsong Public 
//- License, Version 1.0  (the "License"), https://docs.cskefu.com/licenses/v1.html
//- Unless required by applicable law or agreed to in writing, software
//- distributed under the License is distributed on an "AS IS" BASIS,
//- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//- See the License for the specific language governing permissions and
//- limitations under the License.
//- Copyright (C) 2018-Jun. 2023 Chatopera Inc, <https://www.chatopera.com>
//- Licensed under the Apache License, Version 2.0
//- http://www.apache.org/licenses/LICENSE-2.0
table.layui-table(lay-skin='line', style='table-layout: fixed; word-break: break-all;')
    colgroup
        col(width='3%')
        col(width='20%')
        col(width='20%')
        col(width='15%')
        col(width='15%')
    thead
        tr
            th
            th 坐席
            th 登陆时间
            th 最大用户数
            th 服务用户数
    tbody
        if userList && currentorgan
            for agent in userList
                if agent.skills[currentorgan]
                    tr.ukefu-agentstatus
                        td(style="width:1px;padding:10px 0px 10px 10px;")
                            input.agentnoradio.ctxid(type="radio", name="agentno", value= agent.id, onclick="selectAgentnoWithRadioClick(this)", id="user_" + agent.id, style="display:block;")
                        td(title= agent.username + "（" + agent.uname + "）", style="text-overflow: ellipsis;white-space: nowrap;overflow: hidden;") #{agent.username}（#{agent.uname}）
                        td #{agent.agentStatus && agent.agentStatus.logindate ? pugHelper.formatDate('yyyy-MM-dd HH:mm:ss', agent.agentStatus.logindate) : ""}
                        td #{agent.agentStatus.maxusers ? agent.agentStatus.maxusers : 0}
                        td #{agent.agentStatus.users ? agent.agentStatus.users : 0}

    script.
        $(".agentnoradio").onclick = function (e) {
            return false;
        }

        function selectAgentnoWithRadioClick(radiovalue) {
            radiovalue.parentNode.click();
        }